efform_onload = function ()
{
	if($('#flag').val()==7)
	{
	   document.getElementById('ef_region_inqu').style.display = "none";
	}
};  
button_query_onclick = function (){
	efgrid.submitInqu( "ef_grid_result", "ZM","ZMCG71","query");
}
button_insert_onclick = function (){
	var ei_info=new EiInfo();
	ei_info.setByNodeObject(document.forms[0]); 
	if(ei_info.getBlock('inqu_status1').getRows(0)[0][2].trim()==""){
		EFAlert("重点调度记录不能为空");
		return;
	}
	
	var info = getDetail("ef_region_inqu1","inqu_status1");
	if (null != info) { 
		EiCommunicator.send("ZMCG71", "insert", info, ajax_callbackconfirm);
	} 
	window.location.reload(); 
}
button_update_onclick = function (){ 
	var ei_info=new EiInfo();
	ei_info.setByNodeObject(document.forms[0]); 
	if(ei_info.getBlock('inqu_status1').getRows(0)[0][2].trim()==""){
		EFAlert("重点调度记录不能为空");
		return;
	}
	
	var info = getDetail("ef_region_inqu1","inqu_status1");
	if (null != info) {
		EiCommunicator.send("ZMCG71", "update", info, ajax_callbackconfirm);
	} 
	window.location.reload(); 
}
button_delete_onclick = function (){
	var grid=isSelected("ef_grid_result");
	if (grid == 0)return;  
	EFConfirm('你确认要删除吗?', '确认框', function(r) {
		if(r){
			efgrid.submitForm( "ef_grid_result", "ZM","ZMCG71","delete",true);
		}
	}); 
}  
var ajax_callbackconfirm = {
	onSuccess : function(eiInfo) {
		efwindow.hide(); 
		var grid = efgrid.getGridObject("ef_grid_result");
		grid.refresh(eiInfo);
	}, 
	onFail:function(eMsg)
	{
		alert("确认失败，原因："+eMsg);
	}
}

efgrid_onRowClicked = function( grid_id, row_index ){
	if(grid_id == "ef_grid_result"){ 
		var grid = efgrid.getGridObject(grid_id);
//		var fdKeyId=grid.getCellValueByColumnName(row_index,"fdKeyId");				
//		var info = new EiInfo();
//		info.set("fdKeyId",fdKeyId); 
//		$('#inqu_status1-0-fdKeyId').val(fdKeyId);
//		EiCommunicator.send("ZMCG71", "query", info, ajax_callback);  
//	}
//	if(grid_id == "ef_grid_d"){ 
//		var grid = efgrid.getGridObject(grid_id); 
		var selectedRow=grid.getRowData(row_index);
		for(var item in selectedRow){
			var colname=item;
			var colvalue=selectedRow[item];
			$('#ef_region_inqu1').find('#inqu_status1-0-'+colname).val(colvalue);
		} 
	}
}
